import Vue from "vue";
import VueRouter from "vue-router";

//将要使用的路由在这里定义
//首先需要引入这些路由组件

import Home from "../views/home/index.vue";
import About from "../views/about/index.vue";
import AboutChild1 from "../views/about/aboutChild1/index.vue";
import AboutChild2 from "../views/about/aboutChild2/index.vue";
import Min from "../views/about/aboutChild1/min/index.vue";
Vue.use(VueRouter); //全局注册 会多两个方法调用路由 和渲染路由

const router = new VueRouter({
  //history模式没有#  hush是默认模式
  mode: "history",
  routes: [
    {
      path: "/home",
      component: Home,
    },
    {
      path: "/about",
      component: About,
      children: [
        {
          path: "/about/child1",
          component: AboutChild1,
          children: [
            {
              path: "/about/child1/min/:id",
              component: Min,
            },
          ],
        },
        {
          path: "/about/child2",
          component: AboutChild2,
        },
      ],
    },
  ],
});

export default router;
